package cndw.core.util;

import cndw.core.dispatch.Response;
import cndw.core.dispatch.ResponseFactory;
import cndw.core.dispatch.Session;

/**
 * 
 * @author zuojie.x
 */
public final class WriteUtil {
	public static void writeOk(Session session, Object msg) {
		if (msg instanceof Response)
			session.getChannel().write((Response) msg);
		else
			session.getChannel().write(ResponseFactory.ok(msg));
	}

	public static void writeFail(Session session, Object msg) {
		if (msg instanceof Response)
			session.getChannel().write((Response) msg);
		else
			session.getChannel().write(ResponseFactory.fail(msg));
	}
}
